package 题目集.滑动窗口;

import java.util.Scanner;

public class 读出上一个数 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String line = sc.nextLine();
        int n = sc.nextInt();
        StringBuilder pre=new StringBuilder(line);
        while (n-- > 0) {
            StringBuilder cur=new StringBuilder();
            int size = pre.length();
            int i=0,j = 1;
            for (; j < size; j++) {
                if (pre.charAt(j)!=pre.charAt(i)){
                    int count = j-i;
                    cur.append(count).append(pre.charAt(i));
                    i=j;
                }
            }
            cur.append(j-i).append(pre.charAt(i));
            pre=cur;
        }
        System.out.println(pre);
    }
}
